﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using RedDragon.Common.Domain.produceplan;
using RedDragon.RBAC.API.Application.Common.produceplanW;
using System.Globalization;
using T.Common.Domain.Common;


namespace RedDragon.RBAC.API.Controllers
{
    /// <summary>
    /// 主生产计划控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class produceplanController : ControllerBase
    {
        public readonly IMediator mediator;

        public produceplanController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 主生产计划新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanAdd")]
        public async Task<Result> Handle(produceplanCreateCommon request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 主生产计划列表/查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("produceplanList")]
        public async Task<Result> Handle([FromQuery] produceplanSearchCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 主生产计划资源新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanDetailAdd")]
        public async Task<Result> Handle(produceDetailsCreateCommon request)
        {

            return await mediator.Send(request);
        }
        /// <summary>
        /// 主生产计划列表删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanDelete")]
        public async Task<Result> Handle(produceplanDeleteCommon request)
        {

            return await mediator.Send(request);
        }
        /// <summary>
        /// 主生产计划列表反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanFull")]
        public async Task<Result> Handle(ProduceplanFullCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 主生产计划明细列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("produceDetailsList")]
        public async Task<Result> Handle([FromQuery]produceDetailsSearchCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 主生产计划修改方法
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanUpdate")]
        public async Task<Result> Handle(produceplanUpdateCommon request)
        {
            
            return await mediator.Send(request);
        }


        /// <summary>
        /// 主生产计划导入方法
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanImport")]
        public async Task<Result> Handle(ProduceplanImportCommon request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 主生产计划审批
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("produceplanApproval")]
        public async Task<Result> Handle(produceplanApprovalCommon request)
        {
            
            return await mediator.Send(request);
        }
    }
}




